<extend name="Public:base"/>

<block name="main">
<script type="text/javascript" src="__PUBLIC__/js/treetable/jquery.treetable.js"></script>
<div id="yzh-content" class="col-xs-12">
    <div class="main-title">
        <h2>网站导航</h2网站导航>
    </div>

    <div class="table-actions">
        <input type="button" class="btn btn-sm btn-primary" onclick="myform.action='{:U('category/listorder')}';$('#myform').submit();" value="排序" />
        <php>if($_SESSION['userid']==1){</php>
        <button type="button" class="btn btn-sm btn-primary" id="trigger">添加顶级栏目</button>
        <php>}</php>

    </div>

    <form name="myform" id="myform" action="{:U('category/listorder')}" method="post">

        <table id="tree" class="table table-hover table-condensed">
            <thead>
                <tr>
                    <th class="table-cell-1">排序</th>
                    <th class="env-class">栏目ID</th>
                    <th>栏目名称</th>
                    <th class="table-cell-2">所属类型</th>
                    <th class="table-cell-1">导航</th>
                    <th class="table-cell-1">访问</th>
                    <th class="center w-300">管理操作</th>
                </tr>
            </thead>
            <tbody>
            {$categorys}
            </tbody>
        </table>
    </form>
</div>

<script type="text/javascript">

$(document).ready(function() {
    //树配置
    $("#tree").treeTable({
        expandable: true,
    });

});
$(document).ready(function() {
  var modal = $.scojs_modal({
    title: '添加栏目'
    ,remote: "{:U('Category/add')}"
    ,width: '700px'
    ,height:'500px'
  });
  $('#trigger').click(function(){
    modal.show();
  })
});

function add_cat(catid){
  $.scojs_modal({
    title: '添加栏目'
    ,remote: "{:U('Category/add')}"+'&catid='+catid
    ,width: '700px'
    ,height:'500px'
  }).show();
}

function edit_cat(catid,type){
  $.scojs_modal({
    title: '编辑栏目'
    ,remote: "{:U('Category/edit')}"+'&id='+catid+'&type='+type
    ,width: '700px'
    ,height:'500px'
  }).show();
}
</script>

</block>